CC=gcc

AFCOBJS=../../nodemaster.o ../../array_master.o ../../string.o ../../readargs.o ../../stringnode.o ../../base.o\
        ../../dynamic_class.o ../../dynamic_class_master.o ../../hash_master.o ../../dictionary.o ../../cmd_parser.o \
	../../mem_tracker.o

OBJS=../easygui.o ../widgets.o ../context.o ../glob_methods.o ../widgets/*.o $(AFCOBJS)

PROGS=widg tclist multiwin menu_popup optmenu buttons

CFLAGS=-DDEBUG -g -Wall `pkg-config gtk+-2.0 --cflags` `pkg-config gmodule-2.0 --cflags`
LIBS=`pkg-config gtk+-2.0 --libs` `pkg-config gmodule-2.0 --libs`

all:	$(PROGS)

leak: menu_popup_leak

widg: widg.c $(OBJS)
	$(CC) $(CFLAGS) -o widg widg.c $(OBJS) $(LIBS)

tclist:	tclist.c $(OBJS)
	$(CC) $(CFLAGS) -o tclist tclist.c $(OBJS) $(LIBS)

buttons: buttons.c $(OBJS)
	$(CC) $(CFLAGS) -o buttons buttons.c $(OBJS) $(LIBS)

multiwin:	multiwin.c $(OBJS)
	$(CC) $(CFLAGS) -o multiwin multiwin.c $(OBJS) $(LIBS)

drawing:	drawing.c $(OBJS)
	$(CC) $(CFLAGS) -o drawing drawing.c $(OBJS) ../../threader.o $(LIBS) `pkg-config gthread-2.0 --libs`

menu_popup:	menu_popup.c $(OBJS)
	$(CC) $(CFLAGS) -o menu_popup menu_popup.c $(OBJS) $(LIBS)

menu_popup_leak: menu_popup.c
	@echo "Building Leak: $@"
	@$(CC) $(CFLAGS) -fcheck-memory-usage -o $@ $< -lmpatrol -lbfd -liberty $(OBJS) $(LIBS)

toolbar:	toolbar.c $(OBJS)
	$(CC) $(CFLAGS) -o toolbar toolbar.c $(OBJS) $(LIBS)

optmenu:	optmenu.c $(OBJS)
	$(CC) $(CFLAGS) -o optmenu optmenu.c $(OBJS) $(LIBS)

clean:
	@rm $(PROGS)
